﻿@model Stat
@{
    this.ViewBag.Title = "Statistics";
    this.Layout = "~/Views/Shared/_SiteLayout.cshtml";
}

<div class="content">
    <h1>Statistics</h1>
    <div class="monthly-stat">
         <h2>Monthly views</h2>
        <ul>
            @for (int idx = 0; idx < Model.MonthlyViews.Count() - 1; idx++)
            {
                var tuple = Model.MonthlyViews.ElementAt(idx);
                <li>@tuple.Item1 (@tuple.Item2)</li>
            }
            @{
                var lastElem = Model.MonthlyViews.Last();
                <text><li>@lastElem.Item1 (@Model.ViewsThisMonth)</li></text>
            }
        </ul>
    </div>
    <div class="post-stat">
        <h2>Most popular posts</h2>
        <ul>
            @foreach (var post in Model.PageVisits.Values)
            {
                <li><a href="@Url.Action(post.FileID, "Post")">@post.Title</a> (@post.Views)</li>
            }
        </ul>
    </div>
    <div class="clear"></div>
</div>
